home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / i26-gunya2.scm.z / i26-gunya2.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  4.0 KB  |  100 lines

  1. ;;; i26-gunya2.scm -*-scheme-*-
  2. ;;; Time-stamp: <1997/05/11 18:46:26 narazaki@InetQ.or.jp>
  3. ;;; Author: Shuji Narazaki (narazaki@InetQ.or.jp)
  4.  
  5. ;;; Comment:
  6. ;;;  This is the first font decoration of Imigre-26 (i26)
  7. ;;; Code:
  8.  
  9. (define (script-fu-i26-gunya2 text text-color frame-color font font-size frame-size)
  10.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  11.      (border (/ font-size 10))
  12.      (text-layer (car (gimp-text img -1 0 0 text (* border 2) TRUE font-size
  13.                      PIXELS "*" font "*" "*" "*" "*")))
  14.      (width (car (gimp-drawable-width text-layer)))
  15.      (height (car (gimp-drawable-height text-layer)))
  16.      (dist-text-layer (car (gimp-layer-new img width height RGBA_IMAGE
  17.                            "Distorted text" 100 NORMAL)))
  18.      (dist-frame-layer (car (gimp-layer-new img width height RGBA_IMAGE
  19.                         "Distorted text" 100 NORMAL)))
  20.      (distortion-img (car (gimp-image-new width height GRAY)))
  21.      (distortion-layer (car (gimp-layer-new distortion-img width height
  22.                         GRAY_IMAGE "temp" 100 NORMAL)))
  23.      (radius (/ font-size 10))
  24.      (prob 0.5)
  25.      (old-fg (car (gimp-palette-get-foreground)))
  26.      (old-bg (car (gimp-palette-get-background)))
  27.      (old-brush (car (gimp-brushes-get-brush)))
  28.      (old-paint-mode (car (gimp-brushes-get-paint-mode))))
  29.     (gimp-image-disable-undo img)
  30.     (gimp-image-disable-undo distortion-img)
  31.     (gimp-image-resize img width height 0 0)
  32.     (gimp-image-add-layer img dist-text-layer -1)
  33.     (gimp-image-add-layer img dist-frame-layer -1)
  34.     (gimp-image-add-layer distortion-img distortion-layer -1)
  35.     (gimp-selection-none img)
  36.     (gimp-edit-clear img dist-text-layer)
  37.     (gimp-edit-clear img dist-frame-layer)
  38.     ;; get the text shape
  39.     (gimp-selection-layer-alpha img text-layer)
  40.     ;; fill it with the specified color
  41.     (gimp-palette-set-background text-color)
  42.     (gimp-edit-fill img dist-text-layer)
  43.     ;; get the border shape
  44.     (gimp-selection-border img frame-size)
  45.     (gimp-palette-set-background frame-color)
  46.     (gimp-edit-fill img dist-frame-layer)
  47.     (gimp-selection-none img)
  48.     ;; now make the distortion data
  49.     (gimp-palette-set-background '(255 255 255))
  50.     (gimp-edit-fill distortion-img distortion-layer)
  51.     (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0)
  52.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  53.     (plug-in-c-astretch 1 distortion-img distortion-layer) 
  54.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  55.     ;; OK, apply it to dist-text-layer
  56.     (plug-in-displace 1 img dist-text-layer radius radius 1 1
  57.               distortion-layer distortion-layer 0)
  58.     ;; make the distortion data once again fro the frame
  59.     (gimp-edit-fill distortion-img distortion-layer)
  60.     (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0)
  61.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  62.     (plug-in-c-astretch 1 distortion-img distortion-layer) 
  63.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  64.     ;; then, apply it to dist-frame-layer
  65.     (plug-in-displace 1 img dist-frame-layer radius radius 1 1
  66.               distortion-layer distortion-layer 0)
  67.     ;; Finally, clear the bottom layer (text-layer)
  68.     (gimp-selection-all img)
  69.     (gimp-palette-set-background '(255 255 255))
  70.     (gimp-edit-fill img text-layer)
  71.     ;; post processing
  72.     (gimp-palette-set-foreground old-fg)
  73.     (gimp-palette-set-background old-bg)
  74.     (gimp-brushes-set-brush old-brush)
  75.     (gimp-brushes-set-paint-mode old-paint-mode)
  76.     (gimp-image-set-active-layer img dist-text-layer)
  77.     (gimp-image-enable-undo img)
  78.     (gimp-image-delete distortion-img)
  79.     (gimp-display-new img)))
  80.  
  81.  
  82. (script-fu-register "script-fu-i26-gunya2"
  83.             "<Toolbox>/Xtns/Script-Fu/Logos/Imigre-26"
  84.             "Two-colored text by hand"
  85.             "Shuji Narazaki"
  86.             "Shuji Narazaki"
  87.             "1997"
  88.             ""
  89.             SF-VALUE "Text" "\"The GIMP\""
  90.             SF-COLOR "Text Color" '(255 0 0)
  91.             SF-COLOR "Frame Color" '(0 34 255)
  92.             SF-VALUE "Font" "\"Becker\""
  93.             SF-VALUE "Font Size" "100"
  94.             SF-VALUE "Frame Size" "2")
  95.  
  96. ;;; i26-gunya2.scm ends here
  97.  
  98.  
  99.  
  100.